{template 'header'}
<div class="main">
  <h2 class="pubtitle"><span>免费发布信息</span>
    <div class="c"></div>
  </h2>
  <div class="msg message f14"><span class="{if $ac==0}green {else}aaa {/if}f14">第一步：选择信息分类</span>&nbsp;&raquo;&nbsp;<span class="f14{if $ac==1} green{else} aaa{/if}">第二步：填写信息</span>&nbsp;&raquo;&nbsp;<span class="aaa f14">发布完成</span>&nbsp;<span class="aaa" style="text-align:right;margin-left:300px;">违法，欺诈，色情等非法信息将会被删除</span></div>
  {if $ac==0}
  <div id="selector">
    <div><a href="?m=index&c=content&a=pub&catid=1">找家教</a></div>
    <div><a href="?m=index&c=content&a=pub&catid=2">做家教</a></div>
  </div>
  {/if}
  {if $ac==1}
  <div class="table-form" style="border-right:1px solid #E5E5E5; width:750px;float:left;">
  <form action="?m=index&c=content&a=dopub" method="post" name="myform" id="myform">
    <div class="inputbox">
      <label class="t">分&nbsp;类：</label>
      <span class="f14">{$catname}</span>
      <a href="?m=index&c=content&a=pub"><span class="green f14">重新选择</span></a>
      <input type="hidden" name="info[catid]" value="{$catid}" />
    </div>
    <div class="inputbox">
      <label class="t">标&nbsp;题：</label>
      <input type="text" name="info[title]" class="input" id="title" size="50" onkeyup="strlen_verify(this, 'check', 80);" />
      还可以输入<span id="check" style="font-weight:bold">80</span>字
    </div>
    <div class="inputbox">
      <label class="t">科&nbsp;目：</label>
      <select id="objecttype" name="info[objecttype]">
          {loop $objs as $k => $val}
          <option value="{$k}">{$val}</option>
          {/loop}
      </select>
    </div>
    <div class="inputbox">
      <label class="t">培训方式：</label>
      {loop $pxfs as $pk => $pv}
      <input type="radio" name="info[pxfangshi]" id="px{$pk}" value="{$pk}" />&nbsp;<label for="px{$pk}">{$pv}</label>
      {/loop}
    </div>
    <div class="inputbox">
      <label class="t" style="padding-top:40px;">详细信息：</label>
      <textarea name="info[content]" id="content" style="height:100px;width:450px; overflow-y:auto;"></textarea>
    </div>
    <div class="inputbox">
      <label class="t">价格：</label>
      <input type="text" name="info[price]" value="0" id="price" class="input" size="10" />元
    </div>
    <div class="inputbox">
      <label class="t">联系人：</label>
      <input type="text" name="info[c][man]" id="man" class="input" size="40" />
    </div>
    <div class="inputbox">
      <label class="t">手机或电话：</label>
      <input type="text" name="info[c][tel]" id="tel" class="input" size="40" />
    </div>
    <div class="inputbox">
      <label class="t">联系地址：</label>
      <input type="text" name="info[c][addr]" id="addr" class="input" size="60" />
    </div>
    {if !$_SESSION['login']}
    <div class="inputbox">
      <label class="t">&nbsp;</label>
      <div class="login_reg_tab">
      	<span class="cur" id="logintab">登录</span><span id="regtab">注册</span>
        <div class="c"></div>
      </div>
    </div>
    <div class="logintab">
        <div class="inputbox">
          <label class="t">用户名：</label>
          <input type="text" name="info[login][username]" id="lusername" class="input" size="30" />
        </div>
        <div class="inputbox">
          <label class="t">密码：</label>
          <input type="password" name="info[login][password]" id="lpassword" class="input" size="30" />
        </div>
    </div>
    <div class="regtab" style="display:none;">
        <div class="inputbox">
          <label class="t">用户名：</label>
          <input type="text" name="info[reg][username]" class="input" size="30" />
        </div>
        <div class="inputbox regtab">
          <label class="t">密码：</label>
          <input type="password" name="info[reg][password1]" class="input" size="30" />
        </div>
        <div class="inputbox regtab">
          <label class="t">确认密码：</label>
          <input type="password" name="info[reg][password2]" class="input" size="30" />
        </div>
        <div class="inputbox regtab">
          <label class="t">E-mail：</label>
          <input type="text" name="info[reg][email]" class="input" size="30" />
        </div>
    </div>
    {/if}
    <div class="inputbox">
      <label class="t">&nbsp;</label>
      <input type="submit" name="dosubmit" id="dosubmit" class="btn2" value="马上发布" />
      {if !$_SESSION['login']}注册或{/if}发布即代表您<a href="javascript:void(0);" onclick="show_protocol();return false;">已阅读并同意教教家教网使用协议</a>。
    </div>
    </form>
  </div>
  {/if}
  </div>
{template 'footer'}
<script type="text/javascript" src="{JS_PATH}formvalidatorregex.js?v=0514"></script>
<script type="text/javascript" src="{JS_PATH}formvalidator.js?v=0514"></script>
<script type="text/javascript" src="{JS_PATH}strlen_verfiy.js?_=0515"></script>
<script type="text/javascript" src="{JS_PATH}dialog.js?_=0515"></script>
<link href="{CSS_PATH}dialog.css" type="text/css" rel="stylesheet" />
<script type="text/javascript">
function show_protocol()
{
	art.dialog({lock:false,
				title:'会员注册协议',
				id:'protocoliframe', 
				iframe:'?m=member&c=index&a=protocol',
				width:'510',
				height:'350',
				yesText:'我同意协议'}, 
				function(){$("#protocol").attr("checked",true);});
}
$(function()
{
	$('#logintab').click(function(){
		if(!$(this).hasClass('cur')){
			$(this).addClass('cur');
		}
		$('#regtab').removeClass('cur');
		$('div.regtab').hide();
		$('div.logintab').show();
	});
	$('#regtab').click(function(){
		$('div.regtab').show();
		$('div.logintab').hide();
		if(!$(this).hasClass('cur')){
			$(this).addClass('cur');
		}
		$('#logintab').removeClass('cur');
	});

	$.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}});
	$('#title').formValidator({onshow:"请输入标题。", onfocus:"请输入标题"}).inputValidator({min:2,max:80,onerror:"标题长度在2-80个字"});
	$('input[name="info[pxfangshi]"]').formValidator({onshow:'请选择培训方式', onfocus:'请选择培训方式'}).inputValidator({min:1,onerror:"请至少选择一项"});
	$('#content').formValidator({onshow:"请输入详细信息。", onfocus:"请输入详细信息"}).inputValidator({min:2,max:65535,onerror:"详细信息不能为空"});
	$('#price').formValidator({onshow:"价格不填为面议。", onfocus:"请输入价格，不填写此项为面议", oncorrect:'此项为空表示价格为面议', empty:true}).regexValidator({regexp:'decmal4',datatype:'enum',onerror:"价格只能为非负数"}).defaultPassed();
	$('#man').formValidator({'onfocus':'请输入联系人', 'onshow':'请输入联系人'}).inputValidator({min:1, onerror:'联系人不能为空'}).regexValidator({regexp:"ps_username",datatype:"enum",onerror:"联系人格式错误"});
	$('#tel').formValidator({'onfocus':'请输入电话号码', 'onshow':'请输入电话号码'}).inputValidator({min:1, max:20,onerror:'电话号码不能为空'}).regexValidator({regexp:"^(1)[0-9]{9}|(([0\\+]\\d{2,3}-)?(0\\d{2,3})-)?(\\d{7,8})(-(\\d{3,}))?$", onerror:"电话号码格式错误"});
	$('#addr').formValidator({'onfocus':'请输入联系地址', 'onshow':'请输入联系地址'}).inputValidator({min:1, max:80, onerror:'请联系地址不能为空'});
});
</script>